package com.sunagy.demand.backend.service.impl;

import com.sunagy.demand.backend.entity.CustomerUserInfo;
import com.sunagy.demand.backend.VO.request.CustomerUserInfoDto;
import com.sunagy.demand.backend.repository.CustomerUserInfoRepository;
import com.sunagy.demand.backend.service.CustomerUserInfoService;
import com.sunagy.demand.backend.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * desc：#TODO fill me ！
 * author：三餘無夢生
 * date：2018/5/22
 * time：下午4:26
 */
@Service
public class CustomerUserInfoServiceImpl implements CustomerUserInfoService {

    @Autowired
    private CustomerUserInfoRepository customerUserInfoRepository;

    @Override
    public List<CustomerUserInfoDto> getAll() {
        List<CustomerUserInfo> customerUserInfoList = customerUserInfoRepository.findAll();
        List<CustomerUserInfoDto> customerUserInfoDtoList = new ArrayList<>();
        customerUserInfoDtoList = (List<CustomerUserInfoDto>) BeanUtil.copyPropertiesList(customerUserInfoList,CustomerUserInfoDto.class);
        return customerUserInfoDtoList;
    }
}
